package drds.global_transaction.api.exception;

public enum TransactionExceptionCode
{

	//
	unknown,

	//
	lock_conflict,

	//
	io,

	//
	branch_transaction_rollback_failed_but_retriable,

	//
	branch_transaction_rollback_failed_and_unretriable,

	//
	branch_transaction_register_failed,

	//
	branch_transaction_report_failed,

	//
	lockable_check_failed,

	//
	branch_transaction_not_exist,

	//
	global_transaction_not_exist,

	//
	global_transaction_not_active,

	//
	global_transaction_status_invalid,

	//
	failed_send_branch_transaction_commit_request,

	//
	failed_send_branch_transaction_rollback_request,

	//
	failed_add_branch_transaction,;

	public static TransactionExceptionCode get(byte ordinal)
	{
		return get((int) ordinal);
	}

	public static TransactionExceptionCode get(int ordinal)
	{
		for (TransactionExceptionCode value : TransactionExceptionCode.values())
		{
			if (value.ordinal() == ordinal)
			{
				return value;
			}
		}
		throw new IllegalArgumentException("unknown TransactionExceptionCode[" + ordinal + "]");
	}

}
